package cn.db101.api.complex.controller

import cn.db101.api.complex.component.RequestBodyData
import cn.db101.api.complex.entity.WeatherConfig
import cn.db101.api.complex.model.WebResult
import cn.db101.api.complex.model.request.WeatherCurrentRequest
import cn.db101.api.complex.model.request.WeatherFutureRequest
import cn.db101.api.complex.service.WeatherService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile

/**
 * @author zooy
 * @since 2024/8/21-11:55
 */
@RestController
@RequestMapping("api/weather/v1")
open class WeatherController {

    @Autowired
    private lateinit var weatherService: WeatherService

    @PostMapping("current")
    open fun current(@RequestBodyData weatherCurrentRequest: WeatherCurrentRequest): WebResult<Any?> {

        return WebResult.wrapSuccessResult(weatherService.current(weatherCurrentRequest))
    }

    /**
     * 未来天气
     */
    @PostMapping("future")
    open fun future(@RequestBodyData weatherFutureRequest: WeatherFutureRequest): WebResult<Any?> {

        return WebResult.wrapSuccessResult(weatherService.future(weatherFutureRequest))
    }

    @PostMapping("city/dict")
    open fun cityDict(@RequestBodyData weatherConfig: WeatherConfig): WebResult<Any?> {

        return WebResult.wrapSuccessResult(weatherService.cityDict(weatherConfig))
    }

}
